import { defineStore } from 'pinia'
import { getListApi, getdeleteApi, getmodifyApi } from '@/api/Meragement'

// Meragement  这是唯一标识   命名空间
export const userMeragement = defineStore('Meragement', {
    state: () => {
        return {
            list: [],
            page: 1,
            pageSize: 3,
            total: ''
        }
    },
    getters: {

    },
    actions: {
        async getListss() {
            console.log(1111)
            const { data, total } = await getListApi(
                {
                    query: 1,
                    page: this.page - 1,
                    pageSize: this.pageSize
                }
            )
            console.log(data)
            this.list = data
            this.total = total
        },
        async getDelete(_id) {
            console.log(_id)
            await getdeleteApi({ _id })
        },
        async getModify(form) {
            await getmodifyApi(form)
        }

    }
})